package com.tihi.handsuiviewer;

import android.view.MotionEvent;

import com.tihi.treeview.UITreeHolder.UITreeData;
import com.tihi.uiautomator.UIMarkView;
import com.tihi.xml.ViewNode;
import com.tihi.xml.XmlTreeParser;
import com.unnamed.b.atv.model.TreeNode;

/**
 * ui解析界面逻辑
 * @author duantihi
 *
 * @date 2016-2-1 上午11:19:14
 */
public class UIAnaLogic {
	private UIAnaActivity mActivity;
	private UIMarkView markView;
	
	public  UIAnaLogic(UIAnaActivity activity, UIMarkView markView){
		mActivity = activity;
		this.markView = markView;
	}
	
	public void onScreenTouch(MotionEvent event, ViewNode viewNode) {
		switch (event.getAction()) {
		case MotionEvent.ACTION_UP:
			//FIXME, 根据点击的 x, y，计算出当前被点击的view，draw出 view 的边框
			if(viewNode != null) {
				markView.setDrawArea(viewNode.getBoundRectf());
			}
			break;
		default:
			break;
		}
	}
	
	public void onTreeNodeClick(TreeNode node, Object value) {
		UITreeData treeData = (UITreeData)value;
		markView.setDrawArea(treeData.getViewNode().getBoundRectf());
	}

}
